package TPJU;

import TPJU.Sim;
import TPJU.Application;
import java.util.*;


public class Telephone
{
    private String nom;
    private int ram;
    private int memoireExterne;
    private Sim sim;
    private Collection<Application> applications;

    /**
     * Constructor for objects of class T�l�phone
     */
    public Telephone()
    {
        this.nom="";
        this.ram=0;
        this.memoireExterne=0;
        this.setSim(new Sim());
        this.applications=new ArrayList<Application>();
    }
    
    public Telephone(String nom, int memoireInterne, int memoireExterne)
    {
        this.nom=nom;
        this.ram=memoireInterne;
        this.memoireExterne=memoireExterne;
        this.setSim(new Sim());  
        this.applications=new ArrayList<Application>();
    }
    
    public String getNom()
    {
        return this.nom;
    }
    
    public void setNom(String nom)
    {
        this.nom=nom;
    }
    
    public int getMemoireInterne()
    {
        return this.ram;
    }
    
    public void setMemoireInterne(int memoireInterne)
    {
        this.ram=memoireInterne;
    }
    
    public int getMemoireExterne()
    {
        return this.memoireExterne;
    }
    
    public void setMemoireExterne(int memoireExterne)
    {
        this.memoireExterne=memoireExterne;
    }
    
    public int memoireTotale()
    {
        return this.memoireExterne + this.ram;
    }
    
    public void ajoutApplication(Application a)
    {
    	if(!this.applications.contains(a))
    		this.applications.add(a);
    }

    public Collection<Application> getApplications() {
    	return Collections.unmodifiableCollection(this.applications);
    }

    public void setApplications(Collection<Application> applications) {
        this.applications = applications;
    }
    
    public void supprApplication(Application a)
    {
        this.applications.remove(a);
    }

	public Sim getSim() {
		return sim;
	}

	public void setSim(Sim sim) {
		this.sim = sim;
	}
   
}
